<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="lib.css" type='text/css' />
<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
<link rel='start' href='../index.html' title='Python documentation Index' />
<link rel="first" href="lib.html" title='Python library Reference' />
<link rel='contents' href='contents.html' title="Contents" />
<link rel='index' href='genindex.html' title='Index' />
<link rel='last' href='about.html' title='About this document...' />
<link rel='help' href='about.html' title='About this document...' />
<link rel="next" href="trace-api.html" />
<link rel="prev" href="module-trace.html" />
<link rel="parent" href="module-trace.html" />
<link rel="next" href="trace-api.html" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name='aesop' content='information' />
<title>25.10.1 Command Line Usage</title>
</head>
<body>
<div class="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="25.10 trace  "
  href="module-trace.html"><img src='../icons/previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="25.10 trace  "
  href="module-trace.html"><img src='../icons/up.png'
  border='0' height='32'  alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="25.10.2 programming Interface"
  href="trace-api.html"><img src='../icons/next.png'
  border='0' height='32'  alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
  href="contents.html"><img src='../icons/contents.png'
  border='0' height='32'  alt='Contents' width='32' /></a></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
  border='0' height='32'  alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
  href="genindex.html"><img src='../icons/index.png'
  border='0' height='32'  alt='Index' width='32' /></a></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="module-trace.html">25.10 trace  </a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="module-trace.html">25.10 trace  </a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="trace-api.html">25.10.2 Programming Interface</a>
</div>
<hr /></div>
</div>
<!--End of Navigation Panel-->

<h2><a name="SECTION00271010000000000000000"></a><a name="trace-cli"></a>
<br>
25.10.1 Command Line Usage
</h2>

<p>
The <tt class="module">trace</tt> module can be invoked from the command line.  It can be
as simple as

<p>
<div class="verbatim"><pre>
python -m trace --count somefile.py ...
</pre></div>

<p>
The above will generate annotated listings of all Python modules imported
during the execution of <span class="file">somefile.py</span>.

<p>
The following command-line arguments are supported:

<p>
<dl>
<dt><strong><b class="programopt">--trace</b>, <b class="programopt">-t</b></strong></dt>
<dd>Display lines as they are executed.

<p>
</dd>
<dt><strong><b class="programopt">--count</b>, <b class="programopt">-c</b></strong></dt>
<dd>Produce a set of  annotated listing files upon program
completion that shows how many times each statement was executed.

<p>
</dd>
<dt><strong><b class="programopt">--report</b>, <b class="programopt">-r</b></strong></dt>
<dd>Produce an annotated list from an earlier program run that
used the <b class="programopt">--count</b> and <b class="programopt">--file</b> arguments.

<p>
</dd>
<dt><strong><b class="programopt">--no-report</b>, <b class="programopt">-R</b></strong></dt>
<dd>Do not generate annotated listings.  This is useful if you intend to make
several runs with <b class="programopt">--count</b> then produce a single set
of annotated listings at the end.

<p>
</dd>
<dt><strong><b class="programopt">--listfuncs</b>, <b class="programopt">-l</b></strong></dt>
<dd>List the functions executed by running the program.

<p>
</dd>
<dt><strong><b class="programopt">--trackcalls</b>, <b class="programopt">-T</b></strong></dt>
<dd>Generate calling relationships exposed by running the program.

<p>
</dd>
<dt><strong><b class="programopt">--file</b>, <b class="programopt">-f</b></strong></dt>
<dd>Name a file containing (or to contain) counts.

<p>
</dd>
<dt><strong><b class="programopt">--coverdir</b>, <b class="programopt">-C</b></strong></dt>
<dd>Name a directory in which to save annotated listing files.

<p>
</dd>
<dt><strong><b class="programopt">--missing</b>, <b class="programopt">-m</b></strong></dt>
<dd>When generating annotated listings, mark lines which
were not executed with `<code>&gt;&gt;&gt;&gt;&gt;&gt;</code>'.

<p>
</dd>
<dt><strong><b class="programopt">--summary</b>, <b class="programopt">-s</b></strong></dt>
<dd>When using <b class="programopt">--count</b> or <b class="programopt">--report</b>, write a
brief summary to stdout for each file processed.

<p>
</dd>
<dt><strong><b class="programopt">--ignore-module</b></strong></dt>
<dd>Ignore the named module and its submodules (if it is
a package).  May be given multiple times.

<p>
</dd>
<dt><strong><b class="programopt">--ignore-dir</b></strong></dt>
<dd>Ignore all modules and packages in the named directory
and subdirectories.  May be given multiple times.
</dd>
</dl>

<p>

<div class="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="25.10 trace  "
  href="module-trace.html"><img src='../icons/previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="25.10 trace  "
  href="module-trace.html"><img src='../icons/up.png'
  border='0' height='32'  alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="25.10.2 programming Interface"
  href="trace-api.html"><img src='../icons/next.png'
  border='0' height='32'  alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
  href="contents.html"><img src='../icons/contents.png'
  border='0' height='32'  alt='Contents' width='32' /></a></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
  border='0' height='32'  alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
  href="genindex.html"><img src='../icons/index.png'
  border='0' height='32'  alt='Index' width='32' /></a></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="module-trace.html">25.10 trace  </a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="module-trace.html">25.10 trace  </a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="trace-api.html">25.10.2 Programming Interface</a>
</div>
</div>
<hr />
<span class="release-info">Release 2.5.1, documentation updated on 18th April, 2007.</span>
</div>
<!--End of Navigation Panel-->
<address>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</address>
</body>
</html>
